<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.sql.*" %>
        <%@page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	//获取传递过来的id
	String i = request.getParameter("id");
	int id = Integer.parseInt(i);
	//out.print(id);
	//加载驱动
	Class.forName("com.mysql.jdbc.Driver");
	//获取连接对象
	String url = "jdbc:mysql://localhost:3306/test";
	String username = "root";
	String password = "lishanshan";
	Connection conn = DriverManager.getConnection(url, username, password);	
	//定义sql语句
	String sql = "delete from person where id=?;";
	//预编译
	PreparedStatement stmt = conn.prepareStatement(sql);
	//设置参数
	stmt.setInt(1, id);
	//执行
	int count = stmt.executeUpdate();
%>
<script type="text/javascript">
	window.location = "show.jsp";
</script>
</body>
</html>